<template>
  <view class="content">
    <view class="components-title">
      <view class="components-title-t">gg-radio-tag</view>
      <view class="components-title-d">单选</view>
    </view>
    <gg-nav-group>
      <gg-radio-tag label="单选标签" :tip="tip" v-model="formData.radio" :dataLists="radioLists" />
      <gg-radio-tag label="单选标签" :tip="tip" v-model="formData.radio" :dataLists="radioLists" layout="col" must />
    </gg-nav-group>
    <gg-nav-group label="有默认选项">
      <gg-radio-tag label="单选标签" :tip="tip" v-model="formData.radio1" :dataLists="radioLists" />
      <gg-radio-tag label="单选标签" :tip="tip" v-model="formData.radio1" :dataLists="radioLists" layout="col" must />
    </gg-nav-group>
  </view>
</template>

<script>
export default {
  data() {
    return {
      tip: '您需要选择一个最喜爱的水果',
      formData: {
        radio: '',
        radio1: '',
      },
      radioLists: [],
    };
  },
  onLoad() {
    setTimeout(() => {
      this.testReqMocck().then((res) => {
        this.radioLists = [
          { value: 0, text: '橘子' },
          { value: 1, text: '柠檬' },
          { value: 2, text: '香蕉' },
          { value: 3, text: '苹果' },
          { value: 4, text: '榴莲' },
        ]
        console.log('模拟请求数据--选项', this.radioLists,);
      });
    }, 1000)
    setTimeout(() => {
      this.testReqMocck().then((res) => {
        this.formData.radio1 = '0';
        console.log('模拟请求数据--选中', this.formData,);
      });
    }, 2000)
  },
  methods: {
    bindTimeChange(e) {

    },
    clickTest(e) {
      console.log(this.formData.checkboxtag)
    },
    testReqMocck(testData) {
      return new Promise((resolve, reject) => {
        resolve({
        });
      });
    }
  }
}
</script>

<style>
page {
  background: #f1f1f1;
}
</style>
